import cv2
import numpy as np

# 读取图像
height, width, channel, dtype = 512, 512, 3, np.uint8
blank_image = np.zeros((height, width, channel), dtype=dtype)

print(type(blank_image))

# 在图像上绘制文本
text = 'Hello, OpenCV!'
org = (50, 50)  # 文本起始坐标为(50, 50)
fontFace = cv2.FONT_HERSHEY_SIMPLEX
fontScale = 1
color = (255, 0, 0)  # 蓝色
thickness = 2
cv2.putText(blank_image, text, org, fontFace, fontScale, color, thickness)

# 显示图像
cv2.imshow('Image with Text', blank_image)
cv2.waitKey(0)
cv2.destroyAllWindows()